<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>考试题4</title>
</head>
<body>
    <!-- 题目4 -->
    <script>
        
        // 题目: 针对这个代码, 如下代码能捕获到错误的是?
        
        let p = new Promise((resolve, reject) => {
            reject(new Error('请检查'))
        })

        // A:

        async const fnA = () => {
            try {
                const res = await p
            } catch (err) {
                console.error(err)
            }
        }

        // B:

        const fnB = async () => {
            try {
                
            } catch (err) {
                const res = await p
                console.error(err)
            }
        }


        // C: 

        const fnC = async () => {
            try {
                const res = await p
            } catch {
                console.error(err)
            }
        }

        // D:

        const fnD = async () => {
            try {
                const res = await p
            } catch (err) {
                console.error(err)
            }
        }
        


    </script>
</body>
</html>